<?php
$data = require __DIR__ .'/data.php';
$config = array(
		'app_id' => $data['app_id'],
		'app_secret' => $data['app_secret'],
);
$qid = isset($_GET['qid'])?trim($_GET['qid']):'';
$suc = isset($_GET['suc'])?trim($_GET['suc']):0;
require_once __DIR__ . "/wechat/jssdk.php";
require_once __DIR__ . "/include.php";
require_once __DIR__ .'/qwarr.php';

@$jssdk = new JSSDK($config['app_id'], $config['app_secret']);
$url = isset($_REQUEST['url']) ? urldecode($_REQUEST['url']): '';

@$signPackage = $jssdk->GetSignPackage($url);
//$title = "准的吓人!我算的下半年字：{$qname}".randFace();
$title = "我的".randFace()."七夕运势签：{$qname}";
$desc = '准到服了！';
//$jump_url = "http://".get_rand_str(3,8)."."."{$data['d4']}/show.php?qid=$qid&suc=1#_t=".time()*6;
//$imgUrl = $qimg;
//$jump_url = "http://".get_rand_str(3,8)."."."{$data['d4']}";
$suc = 1;
$token = mt_rand(10000,99999);
//$jump_url = "http://".get_rand_str(3,8)."."."{$data['d4']}"."/arED/b/{$qid}/s/{$suc}/show.html?token={$token}";
//$jump_url = "http://{$data['d4']}/arED/b/{$qid}/s/{$suc}/show.html?token={$token}";
$url_1 = "http://{$data['d4']}/?xxid={$data['desc']}&path={$data['back_url']}&qid={$qid}&suc={$suc}&token={$token}";
$url_2 = "http://{$data['d4']}/?xxid={$data['desc']}&qid={$qid}&suc={$suc}&token={$token}";

$jump_url = $data['back_url']?$url_1:$url_2;
$imgUrl = "http://puep.qpic.cn/coral/Q3auHgzwzM4fgQ41VTF2rN7b82YjucHE05O9ic0nt81M1XOaR7P4Rkw/0";
?>
var jssdk = {};
wx.config({
	debug: false,
	appId: '<?php echo $signPackage['appId'];?>',
	timestamp: <?php echo $signPackage['timestamp'];?>,
	nonceStr: '<?php echo $signPackage['nonceStr'];?>',
	signature: '<?php echo $signPackage['signature'];?>',
	jsApiList: ['checkJsApi','hideMenuItems','onMenuShareTimeline','onMenuShareAppMessage']
});
	var share_info = {
		title: '<?php echo $title;?>',
		desc: '<?php echo $desc;?>',
		link: '<?php echo $jump_url;?>',
		link2: '<?php echo $jump_url;?>',
		imgUrl: '<?php echo $imgUrl;?>',
		site: '',
		app: 'q5',
		vid: 1
	};